<?php
declare (strict_types=1);

namespace app\exam\service;

use think\annotation\Inject;
use think\facade\Request;
use app\common\service\BaseService;
use app\common\logic\category\Category as CateLogic;

/**
 * 分类接口类
 *
 * @package app\exam\service
 */
class Category extends BaseService
{

    /**
     * @Inject()
     * @var CateLogic
     */
    protected $cateLogic;

	/**
	 * 获取试题信息及选项
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-02-04
	 * @return [type] [description]
	 */
	public function getTopList()
	{
		$data  = $this->cateLogic->getTopListForSelect(3);

		return $this->parseToData($data, 1, '获取成功');
	}

    public function getTreeStartWithSecondLevel()
    {
        $topId = Request::get('pid/d');
        if (empty($topId)){
            $data=[];
        }else{
            $data  = $this->cateLogic->getTreeStartWithSecondLevel($topId);
        }

        return $this->parseToData($data, 1, '获取成功');
	}

}
